package com.imooc.api.controller.files;

import com.imooc.grance.result.GraceJsonResult;
import com.imooc.pojo.bo.NewAdminBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 *
 * @auther Levi
 * @Date: 2021/03/12/19:46
 * @Description:
 */
@Api(tags = "文件相关的Controller",value = "文件相关的Controller")
@RequestMapping("/fs")
public interface FileUploaderControllerApi {

    @ApiOperation(value = "使用阿里的文件上传接口",notes = "使用阿里的文件上传接口",httpMethod = "POST")
    @PostMapping("/uploadFace")
    public GraceJsonResult uploadFace(String usrId, MultipartFile file) throws Exception;

    /**
     * admin添加人脸图片到GridFS
     * @param newAdminBO
     * @return
     * @throws Exception
     */
    @PostMapping("/uploadToGridFS")
    public GraceJsonResult uploadToGridFS(@RequestBody NewAdminBO newAdminBO) throws Exception;

    /**
     * admin查看人脸图片
     * @param faceId
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    @GetMapping("/readInGridFS")
    public void readInGridFS(@RequestParam  String faceId,
                                            HttpServletRequest request,
                                            HttpServletResponse response) throws Exception;

    /**
     * 读取存放在本地的人脸图片文件
     * @param faceId
     * @param request
     * @param response
     * @throws Exception
     */
    @GetMapping("/readFaceInGridFS")
    public GraceJsonResult readFaceInGridFS(@RequestParam String faceId
            , HttpServletRequest request, HttpServletResponse response) throws Exception;

    /**
     * summernote多文件上传
     * @param userId
     * @param file
     * @return
     * @throws Exception
     */
    @PostMapping("/uploadSomeFiles")
    public GraceJsonResult uploadSomeFiles(String userId, MultipartFile[] file) throws Exception;
}
